ComponentOne Basic Library for UWP
Basic Library Overview / TreeView for UWP / TreeView Creation / Static TreeView Creation
In This Topic
    Static TreeView Creation
    In This Topic

    Each node in the Tree is represented by a name/value pair, defined by the text and value properties of treenode, respectively. The text of a node is rendered, whereas the value of a node is not rendered and is typically used as additional data for handling postback events.

    A static menu is the simplest way to create the treeview structure.

    To display static C1TreeViewItems using XAML syntax, first nest opening and closing <Xaml:C1TreeViewItem> tags between opening and closing tags of the C1TreeView control. Next, create the treeview structure by nesting <Xaml:C1TreeViewItem> elements between opening and closing <Xaml:C1TreeViewItem> tags. Each <Xaml:C1TreeViewItem> element represents a node in the control and maps to a C1TreeViewItem object.

    Declarative syntax can be used to define the C1TreeViewItems inline on your page.

    For example:

    Markup
    Copy Code
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> 
        <Xaml:C1TreeView x:Name="Tree">  
            <Xaml:C1TreeViewItem Header="Book List" IsExpanded="True" IsSelected="True">
                <Xaml:C1TreeViewItem Header="Language Books"/>
                <Xaml:C1TreeViewItem Header="Security Books"/>
                <Xaml:C1TreeViewItem Header="Classic Books">
                    <Xaml:C1TreeViewItem Header="Catch-22"/>
                    <Xaml:C1TreeViewItem Header="The Great Gatsby"/>
                </Xaml:C1TreeViewItem>
            </Xaml:C1TreeViewItem>
        </Xaml:C1TreeView>
    </Grid>
    
    See Also